package com.gxa.autoparts.admin.controller;

import com.gxa.autoparts.admin.config.OnLineCount;
import com.gxa.autoparts.admin.service.CountPeopleService;
import com.gxa.autoparts.core.pojo.CountPeople;
import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;

/**
 * @author Bei
 * @date 2022/1/12 12:13
 */
@Component
public class testListener {


    @Autowired
    CountPeopleService countPeopleService;

        @Scheduled(cron = "59 59 23 * * ?")
        public void saveCount(){
            CountPeople countPeople = new CountPeople();
            countPeople.setCount(OnLineCount.count);
            countPeople.setDay(new Date());
            CountPeople insert = countPeopleService.insert(countPeople);
    }

}

